/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gameheart.client.sprite;

import gameheart.client.sprite.CardSprite;

/**
 *
 * @author win7
 */
public abstract  class MoveState {
   abstract public void updatePosition(CardSprite card, double a, double b, double c, int _speed);
   public boolean isMoving(CardSprite card, double a, double b, double c)
   {
        double perpendicularA = b;
        double perpendicularB = -a;
        double value1 = perpendicularA * card._srcX + perpendicularB * card._srcY - (perpendicularA * card._destX + perpendicularB * card._destY);
        double value2 = perpendicularA *card.getX() + perpendicularB * card.getY() - (perpendicularA *card. _destX + perpendicularB * card._destY);
        if (value1 * value2 <= 0) {
            card.setX(card._destX);
            card.setY(card._destY);
            return false;
        }
        return true;
   }
   
}
